﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using System.Data.SqlClient;

/// <summary>
/// Summary description for UserDAO
/// </summary>
public class UserDAO:DBAccess
{
	public UserDAO()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public bool CheckAccount(string username, string password)
    {
        try
        {
            SqlCommand command = new SqlCommand("select * from Users where Username=@username and Password=@password", conn);
            command.Parameters.AddWithValue("@username", username);
            command.Parameters.AddWithValue("@password", password);
            if (Connect())
            {
                SqlDataReader dr = command.ExecuteReader();
                if (dr.Read())
                {
                    Disconnect(); return true;
                }
            }
        }
        catch (SqlException ex) { }
        catch (Exception ex) { }
        return false;
    }
}